home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 15717 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.7 KB

  1. Path: ix.netcom.com!news
  2. From: philma@ix.netcom.com(Phil Majtan)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: A real basic problem?:  (code!) long integers or compiler problem?
  5. Date: 20 Apr 1996 22:10:05 GMT
  6. Organization: Netcom
  7. Message-ID: <4lbnbt$9r2@dfw-ixnews5.ix.netcom.com>
  8. References: <4l3mom$f26@newsbf02.news.aol.com> <4l699u$cgo@newsbf02.news.aol.com>
  9. NNTP-Posting-Host: det-mi4-10.ix.netcom.com
  10. X-NETCOM-Date: Sat Apr 20  5:10:05 PM CDT 1996
  11.  
  12. In <4l699u$cgo@newsbf02.news.aol.com> theoder@aol.com (The Oder)
  13. writes: 
  14. >
  15. >Repost of original problem:  (code to follow)
  16. >
  17. >I'm in the process of relearning C and have been doing some beginning
  18. >programs on my PC.  I have two compilers (Borland C++ and Power C). 
  19. My
  20. >problem is that when I run a program using "long" integers (i.e.
  21. declare a
  22. >variable as "long"), it locks up immediately and I have to reboot. 
  23. This
  24. >has happened with both compilers and with two different really basic
  25. >programs (i.e. just trying to do a loop that will compute the first 10
  26. >powers of 2, and another one that simply just tries to find the
  27. largest
  28. >positive long value on my computer--> I can find the largest positive
  29. int
  30. >value, but when I convert it to long, it locks up)
  31. >
  32. >Is this a problem I have with BOTH (?!?!) compilers, is it my computer
  33. >(486-DX2, 8 megs RAM) or settings, or is it just something I haven't
  34. >learned yet about long integers?  One of these programs I copied
  35. directly
  36. >from one of TWO books I'm using and it just locks up!
  37. >
  38.  
  39. I tried the code you enclosed and it ran fine, albeit REALLY slowly. 
  40. If you strip out the printf and let it run for a couple of hours
  41. (really), it will finish.  The problem is that a long int is good up to
  42. 2,147,483,648.  That takes a while to count up to.
  43. Enjoy,
  44. Phil
  45.  
  46.